package com.pro.common.service.pay.mq;

import com.pro.common.api.model.request.pay.IEnumPaymentBizType;
import com.pro.common.api.model.mq.PaymentNotifyDataBusiness;
import com.pro.framework.mq.rabbit.MqRabbitPublisher;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 支付 mq发送器
 */
@Service
@RequiredArgsConstructor
public class PayMqProducer {

    private final MqRabbitPublisher rabbitPublisher;

    /**
     * 代收回调后,mq通知业务服务
     */
    public void sendPaymentCallback(IEnumPaymentBizType bizType, PaymentNotifyDataBusiness data) {
        bizType.getRoutingKeys().forEach(routingKey -> rabbitPublisher.send(routingKey, data));
    }
}
